package com.enation.app.javashop.api.client;

import com.enation.app.javashop.model.payment.dos.PaymentBillDO;
import com.enation.app.javashop.model.payment.dto.PayParam;
import com.enation.app.javashop.model.payment.vo.PayBill;
import com.enation.app.javashop.service.payment.PaymentBillManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import java.util.Map;

/**
 * 支付账单client controller
 *
 * @author kingapex
 * @version 1.0
 * @since 7.2.1
 * 2020/4/16
 */
@RestController
@RequestMapping("/client/payment")
@Validated
@ApiIgnore
public class PaymentBillClientController {

    @Autowired
    private PaymentBillManager paymentBillManager;

    @RequestMapping(value = "/bill", method = RequestMethod.POST)
    public PayBill add(@RequestBody PaymentBillDO paymentBill) {
        return paymentBillManager.add(paymentBill);
    }


    @RequestMapping(value = "/bill/{bill_id}", method = RequestMethod.DELETE)
    public void delete(@PathVariable("bill_id") Long billId) {
        paymentBillManager.delete(billId);
    }

    @RequestMapping(value = "/bill/close-trade", method = RequestMethod.POST)
    public void closeTrade(@RequestBody PaymentBillDO paymentBillDO) {
        paymentBillManager.closeTrade(paymentBillDO);
    }

    @RequestMapping(value = "/bill/send-message", method = RequestMethod.POST)
    public void sendCloseTradeMessage(@RequestParam Map<String, Object> map) {
        paymentBillManager.sendCloseTradeMessage(map);
    }


}
